<%@page contentType="text/html; charset=utf-8"%>
<%@ include file="../inc/TagLibs.jsp"%>
<c:set var="pageTitle" value="业务单一览表" />
<c:if test="${currentUser.user.userType==1 || fn:indexOf(currentUser.privs,';NO_BUSI_COST;')==-1}">
	<c:set var="showCost" value="1" />
</c:if>
<%@ include file="../inc/Title.jsp"%>
<head>
<link href="/css/Query.css" rel="stylesheet" type="text/css">
<link href="/calendar/dhtmlgoodies_calendar/dhtmlgoodies_calendar.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" type="text/css" href="/css/BillList.css" />
<script src="/js/QueryList.js"></script>
<script src="/js/popup_ext.js"></script>
<script src="/calendar/dhtmlgoodies_calendar/dhtmlgoodies_calendar.js"></script>
<script language="javascript">
	function doShow(id,examined){
		var editType="";
		if(examined=='Y'){
			<c:if test="${currentUser.user.userType==1 || fn:indexOf(currentUser.privs,';BUSI_MODI;')!=-1}">editType="MODIFY";</c:if>
		}
		<c:if test="${showCost=='1'}">
		var url="/business/BusinessBillEdit.ihtm?id="+id+"&edit_type="+editType;
		ShowIframe("业务单",url,1024,600,"refreshWin()");
		</c:if>
		<c:if test="${showCost!='1'}">
		doPrint(id,"SIMPLE");
		</c:if>
	}
	function refreshWin(){
		if(popRetVal!=null){
			window.location="/business/BusinessBillSearchResult.ihtm?"+getSearchCondition()+"&current_page=${qr.pageIndex}";
		}
	}
	function doPrint(id,type){
		showWin(900,600,"/business/BusinessBillPrint.ihtm?id="+id+"&type="+type);
	}
	<c:if test="${showCost=='1'}">
	function doMultiPrint(){
		var ob_arr = document.getElementsByName("query_checkbox");
		var str="";
		for (i=0;i<ob_arr.length;i++){
			if ((ob_arr[i].checked == true)){
				if(str!=""){
					str=str+";";
				}
				str = str+ob_arr[i].value;
			}
		}
		if(str!=""){
			doPrint(str,"");
		}else{
			ShowAlert('提示框','请选择要打印的业务单',200,100);
		}
	}
	</c:if>
	function checkDateStr(){
		var startDate=document.getElementById("start_date").value;
		if(startDate==null || startDate==''){
			ShowAlert('提示框','请选择订货开始日期',200,100);
			return false;
		}else{
			var arr=startDate.split("-");
			if(arr.length==null || arr.length!=3){
				ShowAlert('提示框','订货开始日期格式不正确',200,100);
				return false;
			}else if(isNaN(arr[0]) || isNaN(arr[1]) || isNaN(arr[2])){
				ShowAlert('提示框','订货开始日期格式不正确',200,100);
				return false;
			}
		}
		var endDate=document.getElementById("end_date").value;
		if(endDate==null || endDate==''){
			ShowAlert('提示框','请选择订货结束日期',200,100);
			return false;
		}else{
			var arr=endDate.split("-");
			if(arr.length==null || arr.length!=3){
				ShowAlert('提示框','订货结束日期格式不正确',200,100);
				return false;
			}else if(isNaN(arr[0]) || isNaN(arr[1]) || isNaN(arr[2])){
				ShowAlert('提示框','订货结束日期格式不正确',200,100);
				return false;
			}
		}
		return true;
	}
	function checkDelDateStr(){
		var startDate=document.getElementById("del_start").value;
		if(startDate==null || startDate==''){
			ShowAlert('提示框','请选择交货开始日期',200,100);
			return false;
		}else{
			var arr=startDate.split("-");
			if(arr.length==null || arr.length!=3){
				ShowAlert('提示框','交货开始日期格式不正确',200,100);
				return false;
			}else if(isNaN(arr[0]) || isNaN(arr[1]) || isNaN(arr[2])){
				ShowAlert('提示框','交货开始日期格式不正确',200,100);
				return false;
			}
		}
		var endDate=document.getElementById("del_end").value;
		if(endDate==null || endDate==''){
			ShowAlert('提示框','请选择交货结束日期',200,100);
			return false;
		}else{
			var arr=endDate.split("-");
			if(arr.length==null || arr.length!=3){
				ShowAlert('提示框','交货结束日期格式不正确',200,100);
				return false;
			}else if(isNaN(arr[0]) || isNaN(arr[1]) || isNaN(arr[2])){
				ShowAlert('提示框','交货结束日期格式不正确',200,100);
				return false;
			}
		}
		return true;
	}
	function checkComDateStr(){
		var startDate=document.getElementById("com_start").value;
		if(startDate==null || startDate==''){
			ShowAlert('提示框','请选择完工开始日期',200,100);
			return false;
		}else{
			var arr=startDate.split("-");
			if(arr.length==null || arr.length!=3){
				ShowAlert('提示框','完工开始日期格式不正确',200,100);
				return false;
			}else if(isNaN(arr[0]) || isNaN(arr[1]) || isNaN(arr[2])){
				ShowAlert('提示框','完工开始日期格式不正确',200,100);
				return false;
			}
		}
		var endDate=document.getElementById("com_end").value;
		if(endDate==null || endDate==''){
			ShowAlert('提示框','请选择完工结束日期',200,100);
			return false;
		}else{
			var arr=endDate.split("-");
			if(arr.length==null || arr.length!=3){
				ShowAlert('提示框','完工结束日期格式不正确',200,100);
				return false;
			}else if(isNaN(arr[0]) || isNaN(arr[1]) || isNaN(arr[2])){
				ShowAlert('提示框','完工结束日期格式不正确',200,100);
				return false;
			}
		}
		return true;
	}
	function createPageParaStr(){
		var str="start_date="+encodeURIComponent(document.getElementById("start_date").value);
		str=str+"&end_date="+encodeURIComponent(document.getElementById("end_date").value);
		
		var prin="A";
		if(document.getElementById("print1").checked){
			prin="Y";
		}else if(document.getElementById("print2").checked){
			prin="N";
		}
		str=str+"&prin="+prin;
		
		var examined="A";
		if(document.getElementById("examine1").checked){
			examined="Y";
		}else if(document.getElementById("examine2").checked){
			examined="N";
		}
		str=str+"&examined="+examined;
		
		var completed="A";
		if(document.getElementById("complete1").checked){
			completed="Y";
		}else if(document.getElementById("complete2").checked){
			completed="N";
		}
		str=str+"&completed="+completed;
		
		var delivered="A";
		if(document.getElementById("deliver1").checked){
			delivered="Y";
		}else if(document.getElementById("deliver2").checked){
			delivered="P";
		}else if(document.getElementById("deliver3").checked){
			delivered="N";
		}
		str=str+"&delivered="+delivered;
		
		var collected="A";
		if(document.getElementById("collected1").checked){
			collected="Y";
		}else if(document.getElementById("collected2").checked){
			collected="N";
		}
		str=str+"&collected="+collected;
		
		var closed="A";
		if(document.getElementById("close1").checked){
			closed="Y";
		}else if(document.getElementById("close2").checked){
			closed="N";
		}
		str=str+"&closed="+closed;
		
		var fav="A";
		if(document.getElementById("fav1").checked){
			fav="Y";
		}else if(document.getElementById("fav2").checked){
			fav="N";
		}
		str=str+"&fav="+fav;
		
		var cc="A";
		if(document.getElementById("cc1").checked){
			cc="Y";
		}else if(document.getElementById("cc2").checked){
			cc="N";
		}
		str=str+"&cc="+cc;
		
		var st="A";
		if(document.getElementById("st1").checked){
			st="INNER";
		}else if(document.getElementById("st2").checked){
			st="ONLINE";
		}
		str=str+"&st="+st;
		
		str=str+"&del_start="+encodeURIComponent(document.getElementById("del_start").value);
		str=str+"&del_end="+encodeURIComponent(document.getElementById("del_end").value);
		str=str+"&com_start="+encodeURIComponent(document.getElementById("com_start").value);
		str=str+"&com_end="+encodeURIComponent(document.getElementById("com_end").value);
		str=str+"&mng_name="+encodeURIComponent(document.getElementById("mng_name").value);
		str=str+"&est_name="+encodeURIComponent(document.getElementById("est_name").value);
		str=str+"&linkman="+encodeURIComponent(document.getElementById("linkman").value);
		str=str+"&phone="+encodeURIComponent(document.getElementById("phone").value);
		str=str+"&bill_code="+encodeURIComponent(document.getElementById("bill_code").value);
		str=str+"&content="+encodeURIComponent(document.getElementById("content").value);
		str=str+"&department="+document.getElementById("department").value;
		str=str+"&min_cost="+encodeURIComponent(document.getElementById("min_cost").value.trim());
		str=str+"&max_cost="+encodeURIComponent(document.getElementById("max_cost").value.trim());
		str=str+"&desi_name="+encodeURIComponent(document.getElementById("desi_name").value);
		str=str+"&foll_name="+encodeURIComponent(document.getElementById("foll_name").value);
		str=str+"&intr_name="+encodeURIComponent(document.getElementById("intr_name").value);
		str=str+"&crea_name="+encodeURIComponent(document.getElementById("crea_name").value);
		str=str+"&cont_code="+encodeURIComponent(document.getElementById("cont_code").value);
		str=str+"&addr="+encodeURIComponent(document.getElementById("addr").value);
		str=str+"&ts_id="+document.getElementById("ts_id").value;
		str=str+"&order_by="+document.getElementById("order_by").value;
		str=str+"&order_sc="+document.getElementById("order_sc").value;
		
		return str;
	}
	
	function createProgramParaStr(){
		var str="start_date="+encodeURIComponent(document.getElementById("hid_start_date").value);
		str=str+"&end_date="+encodeURIComponent(document.getElementById("hid_end_date").value);
		str=str+"&prin=${prin}";
		str=str+"&examined=${examined}";
		str=str+"&completed=${completed}";
		str=str+"&delivered=${delivered}";
		str=str+"&collected=${collected}";
		str=str+"&closed=${closed}";
		str=str+"&fav=${fav}";
		str=str+"&cc=${cc}";
		str=str+"&st=${st}";
		str=str+"&del_start="+encodeURIComponent(document.getElementById("hid_del_start").value);
		str=str+"&del_end="+encodeURIComponent(document.getElementById("hid_del_end").value);
		str=str+"&com_start="+encodeURIComponent(document.getElementById("hid_com_start").value);
		str=str+"&com_end="+encodeURIComponent(document.getElementById("hid_com_end").value);
		str=str+"&mng_name="+encodeURIComponent(document.getElementById("hid_mng_name").value);
		str=str+"&est_name="+encodeURIComponent(document.getElementById("hid_est_name").value);
		str=str+"&linkman="+encodeURIComponent(document.getElementById("hid_linkman").value);
		str=str+"&phone="+encodeURIComponent(document.getElementById("hid_phone").value);
		str=str+"&bill_code="+encodeURIComponent(document.getElementById("hid_bill_code").value);
		str=str+"&content="+encodeURIComponent(document.getElementById("hid_content").value);
		str=str+"&department=${department}";
		str=str+"&min_cost="+encodeURIComponent(document.getElementById("hid_min_cost").value);
		str=str+"&max_cost="+encodeURIComponent(document.getElementById("hid_max_cost").value);
		str=str+"&desi_name="+encodeURIComponent(document.getElementById("hid_desi_name").value);
		str=str+"&foll_name="+encodeURIComponent(document.getElementById("hid_foll_name").value);
		str=str+"&intr_name="+encodeURIComponent(document.getElementById("hid_intr_name").value);
		str=str+"&crea_name="+encodeURIComponent(document.getElementById("hid_crea_name").value);
		str=str+"&cont_code="+encodeURIComponent(document.getElementById("hid_cont_code").value);
		str=str+"&addr="+encodeURIComponent(document.getElementById("hid_addr").value);
		str=str+"&ts_id=${tsId}";
		str=str+"&order_by=${orderBy}";
		str=str+"&order_sc=${orderSc}";
		
		return str;
	}
	function doSearch(){
		var str;
		if(IsAdvSearch){//高级
			str="search_type=1";
			if(document.getElementById("cb_order_date").checked){
				if(checkDateStr()){
					str=str+"&cb_order_date=1";
				}else{
					return;
				}
			}
			if(document.getElementById("cb_del_date").checked){
				if(checkDelDateStr()){
					str=str+"&cb_del_date=1";
				}else{
					return;
				}
			}
			if(document.getElementById("cb_com_date").checked){
				if(checkComDateStr()){
					str=str+"&cb_com_date=1";
				}else{
					return;
				}
			}
			if(document.getElementById("cb_prin").checked){
				str=str+"&cb_prin=1";
			}
			if(document.getElementById("cb_examine").checked){
				str=str+"&cb_examine=1";
			}
			if(document.getElementById("cb_complete").checked){
				str=str+"&cb_complete=1";
			}
			if(document.getElementById("cb_deliver").checked){
				str=str+"&cb_deliver=1";
			}
			if(document.getElementById("cb_col").checked){
				str=str+"&cb_col=1";
			}
			if(document.getElementById("cb_close").checked){
				str=str+"&cb_close=1";
			}
			if(document.getElementById("cb_fav").checked){
				str=str+"&cb_fav=1";
			}
			if(document.getElementById("cb_cc").checked){
				str=str+"&cb_cc=1";
			}
			if(document.getElementById("cb_st").checked){
				str=str+"&cb_st=1";
			}
			if(document.getElementById("cb_mng").checked){
				var mngName=document.getElementById("mng_name").value.trim();
				if(mngName==null || mngName==""){
					ShowAlert('提示框','请输入业务员姓名',200,100);
					return;
				}
				str=str+"&cb_mng=1";
			}
			if(document.getElementById("cb_desi").checked){
				var desiName=document.getElementById("desi_name").value.trim();
				if(desiName==null || desiName==""){
					ShowAlert('提示框','请输入设计员姓名',200,100);
					return;
				}
				str=str+"&cb_desi=1";
			}
			if(document.getElementById("cb_foll").checked){
				var follName=document.getElementById("foll_name").value.trim();
				if(follName==null || follName==""){
					ShowAlert('提示框','请输入跟单人姓名',200,100);
					return;
				}
				str=str+"&cb_foll=1";
			}
			if(document.getElementById("cb_intr").checked){
				var intrName=document.getElementById("intr_name").value.trim();
				if(intrName==null || intrName==""){
					ShowAlert('提示框','请输入业务来源',200,100);
					return;
				}
				str=str+"&cb_intr=1";
			}
			if(document.getElementById("cb_crea").checked){
				var creaName=document.getElementById("crea_name").value.trim();
				if(creaName==null || creaName==""){
					ShowAlert('提示框','请输入开单人姓名',200,100);
					return;
				}
				str=str+"&cb_crea=1";
			}
			if(document.getElementById("cb_est").checked){
				var estName=document.getElementById("est_name").value.trim();
				if(estName==null || estName==""){
					ShowAlert('提示框','请输入订货单位',200,100);
					return;
				}
				str=str+"&cb_est=1";
			}
			if(document.getElementById("cb_linkman").checked){
				var linkman=document.getElementById("linkman").value.trim();
				if(linkman==null || linkman==""){
					ShowAlert('提示框','请输入联系人',200,100);
					return;
				}
				str=str+"&cb_linkman=1";
			}
			if(document.getElementById("cb_phone").checked){
				var phone=document.getElementById("phone").value.trim();
				if(phone==null || phone==""){
					ShowAlert('提示框','请输入电话',200,100);
					return;
				}
				str=str+"&cb_phone=1";
			}
			if(document.getElementById("cb_bill_code").checked){
				var billCode=document.getElementById("bill_code").value.trim();
				if(billCode==null || billCode==""){
					ShowAlert('提示框','请输入业务单号',200,100);
					return;
				}
				str=str+"&cb_bill_code=1";
			}
			if(document.getElementById("cb_content").checked){
				var content=document.getElementById("content").value.trim();
				if(content==null || content==""){
					ShowAlert('提示框','请输入摘要',200,100);
					return;
				}
				str=str+"&cb_content=1";
			}
			if(document.getElementById("cb_dep").checked){
				var department=document.getElementById("department").value;
				if(department==null || department=="" || department=="0"){
					ShowAlert('提示框','请选择部门',200,100);
					return;
				}
				str=str+"&cb_dep=1";
			}
			if(document.getElementById("cb_cost").checked){
				var minCost=document.getElementById("min_cost").value.trim();
				if(minCost==null || minCost==""){
					ShowAlert('提示框','请输入最小金额',200,100);
					return;
				}else if(isNaN(minCost)){
					ShowAlert('提示框','最小金额只能是数字',200,100);
					return;
				}
				var maxCost=document.getElementById("max_cost").value.trim();
				if(maxCost==null || maxCost==""){
					ShowAlert('提示框','请输入最大金额',200,100);
					return;
				}else if(isNaN(maxCost)){
					ShowAlert('提示框','最大金额只能是数字',200,100);
					return;
				}
				str=str+"&cb_cost=1";
			}
			if(document.getElementById("cb_cont_code").checked){
				var contCode=document.getElementById("cont_code").value.trim();
				if(contCode==null || contCode==""){
					ShowAlert('提示框','请输入合同号',200,100);
					return;
				}
				str=str+"&cb_cont_code=1";
			}
			if(document.getElementById("cb_addr").checked){
				var addr=document.getElementById("addr").value.trim();
				if(addr==null || addr==""){
					ShowAlert('提示框','请输入送货地址',200,100);
					return;
				}
				str=str+"&cb_addr=1";
			}
			if(document.getElementById("cb_ts").checked){
				var tsId=document.getElementById("ts_id").value;
				if(tsId==null || tsId=="" || tsId=="0"){
					ShowAlert('提示框','请选择帐套',200,100);
					return;
				}
				str=str+"&cb_ts=1";
			}
			if(document.getElementById("cb_order").checked){
				var orderBy=document.getElementById("order_by").value;
				if(orderBy==null || orderBy==""){
					ShowAlert('提示框','请选择排序类型',200,100);
					return;
				}
				str=str+"&cb_order=1";
			}
		}else{//快速
			str="search_type=2";
			if(!checkDateStr()){
				return;
			}
		}
		var paraStr=createPageParaStr();
		if(paraStr!=""){
			str=str+"&"+paraStr;
		}
		window.location="/business/BusinessBillSearchResult.ihtm?"+str;
	}
	function doGo(pageIndex){
		var str=getSearchCondition();
		str=str+"&current_page="+pageIndex;
		window.location="/business/BusinessBillSearchResult.ihtm?"+str;
	}
	
	function getSearchCondition(){
		var searchType="${searchType}";
		var str="search_type="+searchType;
		if(searchType=="1"){//高级
			<c:if test="${cbOrderDate=='1'}">str=str+"&cb_order_date=1";</c:if>
			<c:if test="${cbPrin=='1'}">str=str+"&cb_prin=1";</c:if>
			<c:if test="${cbComDate=='1'}">str=str+"&cb_com_date=1";</c:if>
			<c:if test="${cbExamine=='1'}">str=str+"&cb_examine=1";</c:if>
			<c:if test="${cbComplete=='1'}">str=str+"&cb_complete=1";</c:if>
			<c:if test="${cbDeliver=='1'}">str=str+"&cb_deliver=1";</c:if>
			<c:if test="${cbCol=='1'}">str=str+"&cb_col=1";</c:if>
			<c:if test="${cbClose=='1'}">str=str+"&cb_close=1";</c:if>
			<c:if test="${cbFav=='1'}">str=str+"&cb_fav=1";</c:if>
			<c:if test="${cbCc=='1'}">str=str+"&cb_cc=1";</c:if>
			<c:if test="${cbSt=='1'}">str=str+"&cb_st=1";</c:if>
			<c:if test="${cbDelDate=='1'}">str=str+"&cb_del_date=1";</c:if>
			<c:if test="${cbMng=='1'}">str=str+"&cb_mng=1";</c:if>
			<c:if test="${cbEst=='1'}">str=str+"&cb_est=1";</c:if>
			<c:if test="${cbLinkman=='1'}">str=str+"&cb_linkman=1";</c:if>
			<c:if test="${cbPhone=='1'}">str=str+"&cb_phone=1";</c:if>
			<c:if test="${cbBillCode=='1'}">str=str+"&cb_bill_code=1";</c:if>
			<c:if test="${cbContent=='1'}">str=str+"&cb_content=1";</c:if>
			<c:if test="${cbDep=='1'}">str=str+"&cb_dep=1";</c:if>
			<c:if test="${cbCost=='1'}">str=str+"&cb_cost=1";</c:if>
			<c:if test="${cbDesi=='1'}">str=str+"&cb_desi=1";</c:if>
			<c:if test="${cbFoll=='1'}">str=str+"&cb_foll=1";</c:if>
			<c:if test="${cbIntr=='1'}">str=str+"&cb_intr=1";</c:if>
			<c:if test="${cbCrea=='1'}">str=str+"&cb_crea=1";</c:if>
			<c:if test="${cbContCode=='1'}">str=str+"&cb_cont_code=1";</c:if>
			<c:if test="${cbAddr=='1'}">str=str+"&cb_addr=1";</c:if>
			<c:if test="${cbTs=='1'}">str=str+"&cb_ts=1";</c:if>
			<c:if test="${cbOrder=='1'}">str=str+"&cb_order=1";</c:if>
		}else{//快速
			
		}
		var paraStr=createProgramParaStr();
		if(paraStr!=""){
			str=str+"&"+paraStr;
		}
		return str;
	}
	function doJump(pageIndex){
		if(window.event.keyCode==13){
			doGo(pageIndex);
		}
	}
	function DoubleClick(it){
		var ob_arr = document.getElementsByName("query_checkbox");
		var id="";
		var examined="";
		if(ob_arr.length>=it.getAttribute("index")){
			id=ob_arr[it.getAttribute("index")-1].value;
			examined=ob_arr[it.getAttribute("index")-1].getAttribute("examined");
		}
		if(id==""){
			return;
		}
		doShow(id,examined);
	}
	function doCancel(){
		window.close();
	}
	function doInit(){
		Window_Onload();
		if(window.screen.availWidth>1280){
			var w=window.screen.availWidth*0.98;
			window.resizeTo(w,600);
			//居中
			var resizeWinTop=(window.screen.availHeight-600)/2;
			var resizeWinLeft=(window.screen.availWidth-w)/2;
			window.moveTo(resizeWinLeft,resizeWinTop);
		}
	}
	function checkInput(){
		if(window.event.keyCode==13){
			doSearch();
		}
	}
	<c:if test="${showCost=='1'}">
	function doDownload(){
		var str=getSearchCondition();
		window.location="/business/BusinessBillSearchResult.ihtm?content_type=EXCEL&"+str;
	}
	</c:if>
	function doAutoCheck(objId){
		document.getElementById(objId).checked=true;
	}
	function selectStafferName(objId,checkObjId){
		var url="/base/StafferMainForSelect.ihtm";
		var cb="selectStafferNameCallBack('"+objId+"','"+checkObjId+"')";
		ShowIframe("选择员工",url,800,500,cb);
	}
	function selectStafferNameCallBack(objId,checkObjId){
		if(popRetVal!=null){
			var arr=popRetVal.split(";");
			document.getElementById(objId).value=arr[1];
			doAutoCheck(checkObjId);
		}
	}
	function setDate(type){
		var d=new Date();
		var startStr="";
		var endStr="";
		if(type=="CURRENT_MONTH"){
			startStr=d.getFullYear()+"-"+(d.getMonth()+1)+"-01";
			endStr=d.getFullYear()+"-"+(d.getMonth()+1)+"-"+d.getDate();
		}else if(type=="PREVIEW_MONTH"){
			d=new Date(d.getFullYear(),d.getMonth(),1);
			d.setDate(d.getDate()-1);
			startStr=d.getFullYear()+"-"+(d.getMonth()+1)+"-1";
			endStr=d.getFullYear()+"-"+(d.getMonth()+1)+"-"+d.getDate();
		}else if(type=="TODAY"){
			startStr=d.getFullYear()+"-"+(d.getMonth()+1)+"-"+d.getDate();
			endStr=d.getFullYear()+"-"+(d.getMonth()+1)+"-"+d.getDate();
		}else if(type=="YESTERDAY"){
			d.setDate(d.getDate()-1);
			startStr=d.getFullYear()+"-"+(d.getMonth()+1)+"-"+d.getDate();
			endStr=d.getFullYear()+"-"+(d.getMonth()+1)+"-"+d.getDate();
		}
		document.getElementById("start_date").value=startStr;
		document.getElementById("end_date").value=endStr;
		doAutoCheck("cb_order_date");
	}
	function showExaPage(id){
		var url="/business/BusinessBillInfoForExamine.ihtm?id="+id;
		ShowIframe("业务单审核",url,1024,500,"refreshWin()");
	}
	function showUnExaPage(id){
		var url="/business/BusinessBillInfoForUnExamine.ihtm?id="+id;
		ShowIframe("业务单反审核",url,900,500,"refreshWin()");
	}
	function showColPage(id){
		var url="/business/BusinessBillInfoForClose.ihtm?id="+id;
		ShowIframe("业务单结清",url,900,500,"refreshWin()");
	}
	function showUnColPage(id){
		var url="/business/BusinessBillInfoForUnClose.ihtm?id="+id;
		ShowIframe("业务单反结清",url,900,500,"refreshWin()");
	}
	function showDelPage(id){
		var url="/business/DeliverBillNew.ihtm?business_bill_id="+id;
		ShowIframe("业务单送货",url,1024,500,"refreshWin()");
	}
	function showDelSearchPage(bbCode){
		showWin(1024,600,'/business/DeliverBillSearchResult.ihtm?search_type=1&cb_bb_code=1&bb_code='+encodeURIComponent(bbCode));
	}
	function showRecPage(id){
		var url="/finance/ReceiveBillNew.ihtm?data_type=BUSINESS&business_bill_id_str="+id;
		ShowIframe("业务单收款",url,1024,500,"refreshPrintWin('REC')");
	}
	function refreshPrintWin(type){
		if(popRetVal!=null){
			var url="/business/BusinessBillSearchResult.ihtm?"+getSearchCondition()+"&current_page=${qr.pageIndex}";
			if(popRetVal.indexOf(";")!=-1){
				var arr=popRetVal.split(";");
				if(arr[1]!=null && arr[1]=="Y"){
					url=url+"&print_id="+arr[0]+"&print_bill="+type;
					if(arr[2]!=null){
						url=url+"&print_detail="+arr[2];
					}
				}
			}
			window.location=url;
		}
	}
	function showAdjPage(id){
		var url="/finance/AdjustTypeSelect.ihtm?bill_type=BUSINESS_BILL";
		ShowIframeNoScroll("选择调帐类型",url,240,230,"doAdjNew("+id+")");
	}
	function doAdjNew(id){
		if(popRetVal!=null){
			var url="/finance/AdjustBillNew.ihtm?data_type=BILL&adjust_type="+popRetVal+"&bill_id_str="+id;
			ShowIframe("调帐单",url,1024,500,"refreshPrintWin('ADJ')");
		}
	}
	function showUnComPage(billCode){
		showWin(900,600,'/business/BusinessBillListForUnComplete.ihtm?search_type=1&cb_bill_code=1&bill_code='+encodeURIComponent(billCode));
	}
	function showComPage(billCode){
		showWin(1024,600,'/business/BusinessBillListForComplete.ihtm?search_type=1&cb_bill_code=1&bill_code='+encodeURIComponent(billCode));
	}
	function doPrintCallBack(){
		var printId="${printId}";
		var printBill="${printBill}";
		var printDetail="${printDetail}";
		if(printId!=null && printId!=""){
			if(printBill=="REC"){
				showWin(900,600,"/finance/ReceiveBillPrint.ihtm?id="+printId+"&print_detail="+printDetail);
			}else if(printBill=="ADJ"){
				showWin(900,600,"/finance/AdjustBillPrint.ihtm?id="+printId);
			}
		}
	}
	function showList(type){
		var str="search_type=1&cb_ts=1&ts_id=DF_TS_ID";
		if(type=='CAN_EXAM'){
			str=str+"&cb_examine=1&examined=N";
		}else if(type=='CAN_MAKE'){
			str=str+"&cb_examine=1&examined=Y&cb_complete=1&completed=N";
		}else if(type=='UN_DELI_COMP'){
			str=str+"&cb_complete=1&completed=Y&cb_deliver=1&delivered=N";
		}else if(type=='UN_DELI'){
			str=str+"&cb_deliver=1&delivered=N&cb_examine=1&examined=Y";
		}else if(type=='UN_RECE'){
			str=str+"&cb_examine=1&examined=Y&cb_col=1&collected=N";
		}else if(type=='CAN_CLOSE'){
			str=str+"&cb_examine=1&examined=Y&cb_col=1&collected=Y&cb_close=1&closed=N";
		}else if(type=='ZERO_COST'){
			str=str+"&cb_cost=1&min_cost=0&max_cost=0";
		}else if(type=='UN_PRINT'){
			str=str+"&cb_prin=1&prin=N";
		}else{
			return;
		}
		window.location="/business/BusinessBillSearchResult.ihtm?"+str;
	}
	function showRelBill(code){
		showWin(1024,600,"/business/BusinessRelBillList.ihtm?code="+encodeURIComponent(code));
	}
	function selectEstName(){
		var url="/base/EstablishmentListForSelect.ihtm?type=CLIENT";
		ShowIframe("选择客户",url,900,500,"selectEstNameCallBack()");
	}
	function selectEstNameCallBack(){
		if(popRetVal!=null){
			document.getElementById("est_name").value=popRetVal[1];
			doAutoCheck("cb_est");
		}
	}
	function showPrintSelect(id){
		ShowIframeNoScroll("选择打印类型","/business/BusinessBillPrintSelect.ihtm",240,280,"showPrintSelectCallBack("+id+")");
	}
	function showPrintSelectCallBack(id){
		if(popRetVal!=null){
			doPrint(id,popRetVal);
		}
	}
</script>
</head>
<c:set var="canExa" value="N" />
<c:set var="canUnExa" value="N" />
<c:set var="canClo" value="N" />
<c:set var="canUnClo" value="N" />
<c:set var="canDel" value="N" />
<c:set var="canDelSearch" value="N" />
<c:set var="canRec" value="N" />
<c:set var="canAdj" value="N" />
<c:set var="canCom" value="N" />
<c:set var="canUnCom" value="N" />
<c:if test="${currentUser.user.userType==1 || fn:indexOf(currentUser.privs,';BUSI_EXAM;')!=-1}"><c:set var="canExa" value="Y" /></c:if>
<c:if test="${currentUser.user.userType==1 || fn:indexOf(currentUser.privs,';BUSI_UN_EXAM;')!=-1}"><c:set var="canUnExa" value="Y" /></c:if>
<c:if test="${currentUser.user.userType==1 || fn:indexOf(currentUser.privs,';BUSI_CLOS;')!=-1}"><c:set var="canCol" value="Y" /></c:if>
<c:if test="${currentUser.user.userType==1 || fn:indexOf(currentUser.privs,';BUSI_UN_CLOS;')!=-1}"><c:set var="canUnCol" value="Y" /></c:if>
<c:if test="${currentUser.user.userType==1 || fn:indexOf(currentUser.privs,';DELI_BILL;')!=-1}"><c:set var="canDel" value="Y" /></c:if>
<c:if test="${currentUser.user.userType==1 || fn:indexOf(currentUser.privs,';DELI_BILL_SEAR;')!=-1}"><c:set var="canDelSearch" value="Y" /></c:if>
<c:if test="${currentUser.user.userType==1 || fn:indexOf(currentUser.privs,';RECE_BILL;')!=-1}"><c:set var="canRec" value="Y" /></c:if>
<c:if test="${currentUser.user.userType==1 || fn:indexOf(currentUser.privs,';ADJU_BILL;')!=-1}"><c:set var="canAdj" value="Y" /></c:if>
<c:if test="${currentUser.user.userType==1 || fn:indexOf(currentUser.privs,';BUSI_COMP;')!=-1}"><c:set var="canCom" value="Y" /></c:if>
<c:if test="${currentUser.user.userType==1 || fn:indexOf(currentUser.privs,';BUSI_UN_COMP;')!=-1}"><c:set var="canUnCom" value="Y" /></c:if>

<body oncontextmenu="return false">
<div class="Wrap"><!-- 页面主框架 -->
    
	<div id="ListContainer" class="Container"><!-- 主体容器 -->
	    
	    <!-- 标题栏 -->
	    <div class="Heading BillIcon">
	        <div class="HeadingContent">
	            <h1>业务单一览表</h1>
	            <span class="Note">通过业务单查询，可以根据业务单状态进行编辑、打印、送货、收款、调账、结清等操作，可以查看业务单的完工进度。<span style="color:black">黑色</span>表示未审核、<span style="color:blue">蓝色</span>表示已审核、<span style="color:red">红色</span>表示已完工、<span style="color:purple">紫色</span>表示已送完货、<span style="color:green">绿色</span>表示已结清。</span>
	        </div>
	    </div>
	
		<!-- 主内容 -->
		<div class="Content">
	        <!-- 筛选控件栏 -->
	        <div class="FilterBar ClearFix">
	            <div class="SearchIcon"></div>
	            <span class="fl">
	            	<table class="MoreOption" cellpadding="0" cellspacing="0">
	            		<th class="c1" width="80px">
	            			<input type="checkbox" name="cb_order_date" id="cb_order_date" <c:if test="${cbOrderDate=='1' || searchType=='2'}">checked="true"</c:if> style="visibility:hidden;" />
	            			订货日期
	            		</th>
	            		<td width="360px">
	            			<input type="text" class="TextBox Datetime" maxlength="15" onKeyUp="checkInput();" onFocus="doAutoCheck('cb_order_date');" id="start_date" name="start_date" value="<c:out value="${startDate}" />">
			            	<img src="/images/calendar.gif" class="imgIconButton" onClick="displayCalendar(document.getElementById('start_date'),'yyyy-mm-dd',this,false,'doAutoCheck(\'cb_order_date\')');">
			            	<input type="hidden" id="hid_start_date" value="<c:out value="${startDate}" />">
			            	至
			            	<input type="text" class="TextBox Datetime" maxlength="15" onKeyUp="checkInput();" onFocus="doAutoCheck('cb_order_date');" id="end_date" name="end_date" value="<c:out value="${endDate}" />">
			            	<img src="/images/calendar.gif" class="imgIconButton" onClick="displayCalendar(document.getElementById('end_date'),'yyyy-mm-dd',this,false,'doAutoCheck(\'cb_order_date\')');">
			            	<input type="hidden" id="hid_end_date" value="<c:out value="${endDate}" />">
			            	<a href="javascript:setDate('CURRENT_MONTH');">本月</a>
							<a href="javascript:setDate('TODAY');">今天</a>
							<a href="javascript:setDate('YESTERDAY');">昨天</a>
							<a href="javascript:setDate('PREVIEW_MONTH');">上月</a>
	            		</td>
	            	</table>
	            </span>
	            <span class="fr">
	            	<a href="javascript:;" id="lnkMoreOption">更多查询选项</a>
		  			<input type="button" value=" 查 询" onClick="doSearch();" class="buttom search-but" id="sSearchButton" name="sSearchButton">
	                <input type="button" value=" 导 出" onClick="doDownload();" class="buttom search-out" id="sDownloadButton" name="sDownloadButton" <c:if test="${showCost!='1' || currentUser.user.userType!=1 && fn:indexOf(currentUser.privs,';NO_EXPO;')!=-1}">disabled="true"</c:if>>
	                <input type="button" value=" 打 印" onClick="doMultiPrint();" class="buttom search-print" id="sPrintButton" name="sPrintButton" <c:if test="${showCost!='1'}">disabled="true"</c:if>>
	            </span>
				<div id="dvMoreOptionBox" class="MoreOptionBox" style="display:none;">
					<table class="MoreOption" cellpadding="0" cellspacing="0">
						<tr>
							<th class="c1" width="80px">
			        			<input type="checkbox" name="cb_bill_code" id="cb_bill_code" <c:if test="${cbBillCode=='1'}">checked="true"</c:if>>
			        			业务单号
			        		</th>
			        		<td class="c1" width="260px">
			        			<input type="text" class="TextBox" maxlength="50" name="bill_code" id="bill_code" onFocus="doAutoCheck('cb_bill_code');" onKeyUp="checkInput();" value="<c:out value="${billCode}" />">
								<input type="hidden" id="hid_bill_code" value="<c:out value="${billCode}" />">
			    			</td>
			    			<th class="c2" width="80px">
	                        	<input type="checkbox" name="cb_prin" id="cb_prin" <c:if test="${cbPrin=='1'}">checked="true"</c:if>>
	                        	打印状态
	                        </th>
	                        <td class="c2" width="250px">
	                        	<input type="radio" name="printed" id="print1" onClick="doAutoCheck('cb_prin');" <c:if test="${prin=='Y'}">checked="true"</c:if>>已打印
	                        	<input type="radio" name="printed" id="print2" onClick="doAutoCheck('cb_prin');" <c:if test="${prin=='N'}">checked="true"</c:if>>未打印
	                        	<input type="radio" name="printed" id="print3" onClick="doAutoCheck('cb_prin');" <c:if test="${prin==null || prin=='' || prin=='A'}">checked="true"</c:if>>全部
	                    	</td>
	                    	<th class="c3" width="80px">
			        			<input type="checkbox" name="cb_cost" id="cb_cost" <c:if test="${cbCost=='1'}">checked="true"</c:if>>
			        			订货金额
			        		</th>
			    			<td width="180px">
			        			<input type="text" class="TextBox Money" maxlength="15" onKeyUp="checkInput();" onFocus="doAutoCheck('cb_cost');" id="min_cost" name="min_cost" value="${minCost}">
								至
								<input type="text" class="TextBox Money" maxlength="15" onKeyUp="checkInput();" onFocus="doAutoCheck('cb_cost');" id="max_cost" name="max_cost" value="${maxCost}">
								<input type="hidden" id="hid_min_cost" value="<c:out value="${minCost}" />">
								<input type="hidden" id="hid_max_cost" value="<c:out value="${maxCost}" />">
			    			</td>
			    		</tr>
			    		<tr>
			    			<th class="c1">
	                        	<input type="checkbox" name="cb_del_date" id="cb_del_date" <c:if test="${cbDelDate=='1'}">checked="true"</c:if>>
	                        	交货日期
	                        </th>
	                        <td>
	                        	<input type="text" class="TextBox Datetime" maxlength="15" onKeyUp="checkInput();" onFocus="doAutoCheck('cb_del_date');" id="del_start" name="del_start" value="<c:out value="${delStart}" />">
	                        	<img src="/images/calendar.gif" class="imgIconButton" onClick="displayCalendar(document.getElementById('del_start'),'yyyy-mm-dd',this,false,'doAutoCheck(\'cb_del_date\')');">
	                        	<input type="hidden" id="hid_del_start" value="<c:out value="${delStart}" />">
	                        	至
	                        	<input type="text" class="TextBox Datetime" maxlength="15" onKeyUp="checkInput();" onFocus="doAutoCheck('cb_del_date');" id="del_end" name="del_end" value="<c:out value="${delEnd}" />">
	                        	<img src="/images/calendar.gif" class="imgIconButton" onClick="displayCalendar(document.getElementById('del_end'),'yyyy-mm-dd',this,false,'doAutoCheck(\'cb_del_date\')');">
	                        	<input type="hidden" id="hid_del_end" value="<c:out value="${delEnd}" />">
	                    	</td>
	                    	<th class="c2">
	                        	<input type="checkbox" name="cb_examine" id="cb_examine" <c:if test="${cbExamine=='1'}">checked="true"</c:if>>
	                        	审核状态
	                        </th>
	                    	<td class="c2">
	                        	<input type="radio" name="examined" id="examine1" onClick="doAutoCheck('cb_examine');" <c:if test="${examined==null || examined=='' || examined=='Y'}">checked="true"</c:if>>已审核
	                        	<input type="radio" name="examined" id="examine2" onClick="doAutoCheck('cb_examine');" <c:if test="${examined=='N'}">checked="true"</c:if>>未审核
	                        	<input type="radio" name="examined" id="examine3" onClick="doAutoCheck('cb_examine');" <c:if test="${examined=='A'}">checked="true"</c:if>>全部
	                    	</td>
			    			<th class="c3">
			        			<input type="checkbox" name="cb_mng" id="cb_mng" <c:if test="${cbMng=='1'}">checked="true"</c:if>>
			        			业务员
			        		</th>
			    			<td class="c3">
			        			<input type="text" class="TextBox" maxlength="15" name="mng_name" id="mng_name" onKeyUp="checkInput();" onFocus="doAutoCheck('cb_mng');" value="<c:out value="${mngName}" />" >
	                        	<img src="/images/make-a.gif" class="imgIconButton" onClick="selectStafferName('mng_name','cb_mng');" />
	                        	<input type="hidden" id="hid_mng_name" value="<c:out value="${mngName}" />">
			    			</td>
	                	</tr>
	                	<tr>
	                		<th class="c1">
	                        	<input type="checkbox" name="cb_com_date" id="cb_com_date" <c:if test="${cbComDate=='1'}">checked="true"</c:if>>
	                        	完工日期
	                        </th>
	                        <td>
	                        	<input type="text" class="TextBox Datetime" maxlength="15" onKeyUp="checkInput();" onFocus="doAutoCheck('cb_com_date');" id="com_start" name="com_start" value="<c:out value="${comStart}" />">
	                        	<img src="/images/calendar.gif" class="imgIconButton" onClick="displayCalendar(document.getElementById('com_start'),'yyyy-mm-dd',this,false,'doAutoCheck(\'cb_com_date\')');">
	                        	<input type="hidden" id="hid_com_start" value="<c:out value="${comStart}" />">
	                        	至
	                        	<input type="text" class="TextBox Datetime" maxlength="15" onKeyUp="checkInput();" onFocus="doAutoCheck('cb_com_date');" id="com_end" name="com_end" value="<c:out value="${comEnd}" />">
	                        	<img src="/images/calendar.gif" class="imgIconButton" onClick="displayCalendar(document.getElementById('com_end'),'yyyy-mm-dd',this,false,'doAutoCheck(\'cb_com_date\')');">
	                        	<input type="hidden" id="hid_com_end" value="<c:out value="${comEnd}" />">
	                    	</td>
	                    	<th class="c2">
	                        	<input type="checkbox" name="cb_complete" id="cb_complete" <c:if test="${cbComplete=='1'}">checked="true"</c:if>>
	                        	完工状态
	                        </th>
	                    	<td class="c2">
	                        	<input type="radio" name="completed" id="complete1" onClick="doAutoCheck('cb_complete');" <c:if test="${completed==null || completed=='' || completed=='Y'}">checked="true"</c:if>>已完工
	                        	<input type="radio" name="completed" id="complete2" onClick="doAutoCheck('cb_complete');" <c:if test="${completed=='N'}">checked="true"</c:if>>未完工
	                        	<input type="radio" name="completed" id="complete3" onClick="doAutoCheck('cb_complete');" <c:if test="${completed=='A'}">checked="true"</c:if>>全部
			    			</td>
			    			<th class="c3">
			        			<input type="checkbox" name="cb_desi" id="cb_desi" <c:if test="${cbDesi=='1'}">checked="true"</c:if>>
			        			设计员
			        		</th>
			    			<td class="c3">
			        			<input type="text" class="TextBox" maxlength="15" name="desi_name" id="desi_name" onKeyUp="checkInput();" onFocus="doAutoCheck('cb_desi');" value="<c:out value="${desiName}" />" >
	                        	<img src="/images/make-a.gif" class="imgIconButton" onClick="selectStafferName('desi_name','cb_desi');" />
	                        	<input type="hidden" id="hid_desi_name" value="<c:out value="${desiName}" />">
			    			</td>
	                	</tr>
	                	<tr>
	                		<th class="c1">
			        			<input type="checkbox" name="cb_cont_code" id="cb_cont_code" <c:if test="${cbContCode=='1'}">checked="true"</c:if>>
			        			合同号
			        		</th>
			    			<td class="c1">
			        			<input type="text" class="TextBox" maxlength="50" name="cont_code" id="cont_code" onKeyUp="checkInput();" onFocus="doAutoCheck('cb_cont_code');" value="<c:out value="${contCode}" />" >
								<input type="hidden" id="hid_cont_code" value="<c:out value="${contCode}" />">
							</td>
	                    	<th class="c2">
	                        	<input type="checkbox" name="cb_deliver" id="cb_deliver" <c:if test="${cbDeliver=='1'}">checked="true"</c:if>>
	                        	送货状态
	                        </th>
	                    	<td class="c2">
	                        	<input type="radio" name="deliver" id="deliver1" onClick="doAutoCheck('cb_deliver');" <c:if test="${delivered==null || delivered=='' || delivered=='Y'}">checked="true"</c:if> >已送完
	                        	<input type="radio" name="deliver" id="deliver2" onClick="doAutoCheck('cb_deliver');" <c:if test="${delivered=='P'}">checked="true"</c:if> >未送完
	                        	<input type="radio" name="deliver" id="deliver3" onClick="doAutoCheck('cb_deliver');" <c:if test="${delivered=='N'}">checked="true"</c:if> >未送货
	                        	<input type="radio" name="deliver" id="deliver4" onClick="doAutoCheck('cb_deliver');" <c:if test="${delivered=='A'}">checked="true"</c:if> >全部
			    			</td>
			    			<th class="c3">
			        			<input type="checkbox" name="cb_foll" id="cb_foll" <c:if test="${cbFoll=='1'}">checked="true"</c:if>>
			        			跟单员
			        		</th>
			    			<td class="c3">
			        			<input type="text" class="TextBox" maxlength="15" name="foll_name" id="foll_name" onKeyUp="checkInput();" onFocus="doAutoCheck('cb_foll');" value="<c:out value="${follName}" />" >
	                        	<img src="/images/make-a.gif" class="imgIconButton" onClick="selectStafferName('foll_name','cb_foll');" />
	                        	<input type="hidden" id="hid_foll_name" value="<c:out value="${follName}" />">
			    			</td>
	                	</tr>
	                	<tr>
	                		<th class="c1">
			        			<input type="checkbox" name="cb_est" id="cb_est" <c:if test="${cbEst=='1'}">checked="true"</c:if>>
			        			订货单位
			        		</th>
			    			<td class="c1">
			        			<input type="text" class="TextBox" maxlength="50" name="est_name" id="est_name" onKeyUp="checkInput();" onFocus="doAutoCheck('cb_est');" value="<c:out value="${estName}" />">
								<img class="imgIconButton" src="/images/make-a.gif" onClick="selectEstName();" />
								<input type="hidden" id="hid_est_name" value="<c:out value="${estName}" />">
			    			</td>
			    			<th class="c2">
			        			<input type="checkbox" name="cb_col" id="cb_col" <c:if test="${cbCol=='1'}">checked="true"</c:if>>
			        			收款状态
			        		</th>
			    			<td class="c2">
			        			<input type="radio" name="collected" id="collected1" onClick="doAutoCheck('cb_col');" <c:if test="${collected=='Y'}">checked="true"</c:if>>已收完
								<input type="radio" name="collected" id="collected2" onClick="doAutoCheck('cb_col');" <c:if test="${collected=='N'}">checked="true"</c:if>>未收完
								<input type="radio" name="collected" id="collected3" onClick="doAutoCheck('cb_col');" <c:if test="${collected==null || collected=='' || collected=='A'}">checked="true"</c:if>>全部
							</td>
			    			<th class="c3">
			        			<input type="checkbox" name="cb_intr" id="cb_intr" <c:if test="${cbIntr=='1'}">checked="true"</c:if>>
			        			业务来源
			        		</th>
			    			<td class="c3">
			        			<input type="text" class="TextBox" maxlength="15" name="intr_name" id="intr_name" onKeyUp="checkInput();" onFocus="doAutoCheck('cb_intr');" value="<c:out value="${intrName}" />" >
	                        	<img src="/images/make-a.gif" class="imgIconButton" onClick="selectStafferName('intr_name','cb_intr');" />
	                        	<input type="hidden" id="hid_intr_name" value="<c:out value="${intrName}" />">
	                    	</td>
	                	</tr>
	                	<tr>
	                		<th class="c1">
			        			<input type="checkbox" name="cb_linkman" id="cb_linkman" <c:if test="${cbLinkman=='1'}">checked="true"</c:if>>
			        			联系人
			        		</th>
			    			<td class="c1">
			        			<input type="text" class="TextBox" maxlength="50" name="linkman" id="linkman" onFocus="doAutoCheck('cb_linkman');" onKeyUp="checkInput();" value="<c:out value="${linkman}" />">
								<input type="hidden" id="hid_linkman" value="<c:out value="${linkman}" />">
							</td>
	                    	<th class="c2">
	                        	<input type="checkbox" name="cb_close" id="cb_close" <c:if test="${cbClose=='1'}">checked="true"</c:if>>
	                        	结清状态
	                        </th>
	                    	<td class="c2">
		                        <input type="radio" name="closed" id="close1" onClick="doAutoCheck('cb_close');" <c:if test="${closed=='Y'}">checked="true"</c:if>>已结清
		                        <input type="radio" name="closed" id="close2" onClick="doAutoCheck('cb_close');" <c:if test="${closed==null || closed=='' || closed=='N'}">checked="true"</c:if>>未结清
		                        <input type="radio" name="closed" id="close3" onClick="doAutoCheck('cb_close');" <c:if test="${closed=='A'}">checked="true"</c:if>>全部
			    			</td>
			    			<th class="c3">
			        			<input type="checkbox" name="cb_crea" id="cb_crea" <c:if test="${cbCrea=='1'}">checked="true"</c:if>>
			        			开单人
			        		</th>
			    			<td class="c3">
			        			<input type="text" class="TextBox" maxlength="15" name="crea_name" id="crea_name" onKeyUp="checkInput();" onFocus="doAutoCheck('cb_crea');" value="<c:out value="${creaName}" />">
								<img class="imgIconButton" src="/images/make-a.gif" onClick="selectStafferName('crea_name','cb_crea');" />
								<input type="hidden" id="hid_crea_name" value="<c:out value="${creaName}" />">
			    			</td>
	                	</tr>
	                	<tr>
	                		<th class="c1">
			        			<input type="checkbox" name="cb_phone" id="cb_phone" <c:if test="${cbPhone=='1'}">checked="true"</c:if>>
			        			电话
			        		</th>
			    			<td class="c1">
			        			<input type="text" class="TextBox" maxlength="50" name="phone" id="phone" onFocus="doAutoCheck('cb_phone');" onKeyUp="checkInput();" value="<c:out value="${phone}" />">
								<input type="hidden" id="hid_phone" value="<c:out value="${phone}" />">
			    			</td>
	                    	<th class="c2">
	                        	<input type="checkbox" name="cb_fav" id="cb_fav" <c:if test="${cbFav=='1'}">checked="true"</c:if>>
	                        	优惠状态
	                        </th>
	                    	<td class="c2">
		                        <input type="radio" name="fav" id="fav1" onClick="doAutoCheck('cb_fav');" <c:if test="${fav=='Y'}">checked="true"</c:if>>有优惠
		                        <input type="radio" name="fav" id="fav2" onClick="doAutoCheck('cb_fav');" <c:if test="${fav=='N'}">checked="true"</c:if>>无优惠
		                        <input type="radio" name="fav" id="fav3" onClick="doAutoCheck('cb_fav');" <c:if test="${fav==null || fav=='' || fav=='A'}">checked="true"</c:if>>全部
			    			</td>
			    			<th class="c3">
			        			<input type="checkbox" name="cb_dep" id="cb_dep" <c:if test="${cbDep=='1'}">checked="true"</c:if>>
			        			部门
			        		</th>
			    			<td class="c3">
			        			<select name="department" id="department" onFocus="doAutoCheck('cb_dep');">
	                            	<option value="0">==请选择==</option>
	                            	<commonTag:createSelectTree list="${departmentList}" emptyOption="0" defaultValue="${department}" />
	                        	</select>
	                        </td>
	                	</tr>
	                	<tr>
			    			<th class="c1">
			        			<input type="checkbox" name="cb_content" id="cb_content" <c:if test="${cbContent=='1'}">checked="true"</c:if>>
			        			摘要
			        		</th>
			        		<td class="c1">
			        			<input type="text" class="TextBox" maxlength="50" name="content" id="content" onKeyUp="checkInput();" onFocus="doAutoCheck('cb_content');" value="${content}" >
								<input type="hidden" id="hid_content" value="<c:out value="${content}" />">
			    			</td>
	                    	<th class="c2">
	                    		<input type="checkbox" name="cb_cc" id="cb_cc" <c:if test="${cbCc=='1'}">checked="true"</c:if>>
	                        	合同
			        		</th>
			    			<td class="c2">
			    				<input type="radio" name="cc" id="cc1" onClick="doAutoCheck('cb_cc');" <c:if test="${cc=='Y'}">checked="true"</c:if>>有合同号
		                        <input type="radio" name="cc" id="cc2" onClick="doAutoCheck('cb_cc');" <c:if test="${cc=='N'}">checked="true"</c:if>>无合同号
		                        <input type="radio" name="cc" id="cc3" onClick="doAutoCheck('cb_cc');" <c:if test="${cc==null || cc=='' || cc=='A'}">checked="true"</c:if>>全部
			    			</td>
			    			<th class="c3">
			        			<input type="checkbox" name="cb_addr" id="cb_addr" <c:if test="${cbAddr=='1'}">checked="true"</c:if>>
			        			送货地址
			        		</th>
			    			<td class="c3">
			        			<input type="text" class="TextBox" maxlength="50" name="addr" id="addr" onKeyUp="checkInput();" onFocus="doAutoCheck('cb_addr');" value="${addr}" >
			        			<input type="hidden" id="hid_addr" value="<c:out value="${addr}" />">
			        		</td>
	                	</tr>
	                	<tr>
			    			<th class="c1">
			        			<input type="checkbox" name="cb_ts" id="cb_ts" <c:if test="${cbTs=='1'}">checked="true"</c:if>>
	                        	账套
			        		</th>
			        		<td class="c1">
			        			<select name="ts_id" id="ts_id" onFocus="doAutoCheck('cb_ts');">
				    				<option value="0">==请选择账套==</option>
				    				<c:forEach var="item" items="${tsList}">
									<option value="${item.id}" <c:if test="${tsId==item.id}">selected</c:if>>${item.title}</option></c:forEach>
								</select>
			    			</td>
	                    	<th class="c2">
	                    		<input type="checkbox" name="cb_st" id="cb_st" <c:if test="${cbSt=='1'}">checked="true"</c:if>>
	                        	录入途径
			        		</th>
			    			<td class="c2">
			    				<input type="radio" name="st" id="st1" onClick="doAutoCheck('cb_st');" <c:if test="${st=='INNER'}">checked="true"</c:if>>本系统录入
		                        <input type="radio" name="st" id="st2" onClick="doAutoCheck('cb_st');" <c:if test="${st=='ONLINE'}">checked="true"</c:if>>客户在线下单
		                        <input type="radio" name="st" id="st3" onClick="doAutoCheck('cb_st');" <c:if test="${st==null || st=='' || st=='A'}">checked="true"</c:if>>全部
			    			</td>
			    			<th class="c3">&nbsp;</th>
			    			<td class="c3">&nbsp;</td>
	                	</tr>
			    	</table>
			    	<div class="OptionOrderBy">
	                	<input type="checkbox" name="cb_order" id="cb_order" <c:if test="${cbOrder=='1'}">checked="true"</c:if>>
	                    	排序类型
	                    <select name="order_by" id="order_by" onFocus="doAutoCheck('cb_order');">
	                        <option value="">==请选择==</option>
	                        <option value="ORDER_DATE" <c:if test="${orderBy=='ORDER_DATE'}">selected</c:if>>订货日期</option>
	                        <option value="DELIVER_DATE" <c:if test="${orderBy=='DELIVER_DATE'}">selected</c:if>>交货日期</option>
	                        <option value="COST" <c:if test="${orderBy=='COST'}">selected</c:if>>金额</option>
	                        <option value="BILL_CODE" <c:if test="${orderBy=='BILL_CODE'}">selected</c:if>>单号</option>
	                        <option value="CONTENT" <c:if test="${orderBy=='CONTENT'}">selected</c:if>>摘要</option>
	                        <option value="EST_NAME" <c:if test="${orderBy=='EST_NAME'}">selected</c:if>>订货单位</option>
	                    </select>
	                    <select name="order_sc" id="order_sc" onFocus="doAutoCheck('cb_order');">
	                        <option value="ASC" <c:if test="${orderSc=='ASC'}">selected</c:if>>升序</option>
	                        <option value="DESC" <c:if test="${orderSc=='DESC'}">selected</c:if>>降序</option>
	                    </select>
	                    <span class="fr"><a href="javascript:;" id="lnkHiddenOption">隐藏查询选项</a></span>
	                </div>
				</div>
			</div>
			
			<!-- 提示信息显示栏 -->
	        <div class="MsgBar">
	            <%@include file="../inc/AlertMsg.jsp"%>
	        </div>
	        
	        <!-- 上栏 分页、操作等 -->
	        <div class="TopToolBar">
	            <table class="ListNoteInfo" cellpadding="0" cellspacing="0">
	            	<tr>
	                	<td>
	                		选择：
	                		<a href="javascript:showList('CAN_EXAM');">待审核</a>
		  	    			<a href="javascript:showList('CAN_MAKE');">要制作</a>
					  	    <a href="javascript:showList('UN_DELI_COMP');">完工未送货</a>
					  	    <a href="javascript:showList('UN_DELI');">未送货</a>
					  	    <a href="javascript:showList('UN_RECE');">未收完款</a>
					  	    <a href="javascript:showList('CAN_CLOSE');">待结清</a>
					  	    <a href="javascript:showList('ZERO_COST');">零金额</a>
					  	    <a href="javascript:showList('UN_PRINT');">未打印</a>
							<c:if test="${currentUser.user.userType==1 || fn:indexOf(currentUser.privs,';NO_TOTA;')==-1}">
								<br>
								<c:if test="${showCost=='1'}">
		            				<span>合同：${costTotal}元（已优惠：${favTotal}元） 调账：${adjustTotal}元</span>
		                			<span>已收：${collectTotal}元（其中预付款：${imprestTotal}元） 欠款：${costTotal+adjustTotal-collectTotal}元</span>
								</c:if>
		            			<span>面积合计：${squareTotal}平方米</span>
			        			<span>长度合计：${lengMTotal}米&nbsp;${lengCmTotal}公分</span>
			        			<span>合同单数：${qr.totalCount}笔</span>
			        			<c:if test="${showCost=='1'}"><span>回款率：${percent}%</span></c:if>
							</c:if>
	                	</td>
	            	</tr>
	            </table>
			</div>
	        
	        <div class="table-list">
	        	<table width="100%">
	        		<tr>
					  	<th width="14"><input type="checkbox" onClick="javascript:checkall(this);"></th>
					  	<th width="10%">单号</td>
						<th width="6%">订货日期</td>
						<th width="10%">订货单位</td>
						<th width="10%">摘要</td>
						<th width="6%">金额</td>
						<th width="6%">调账</td>
						<th width="6%">已收</td>
						<th width="6%">欠款</td>
						<th width="7%">设计</td>
						<th width="5%">跟单员</td>
						<th width="6%">最后打印</td>
						<th width="6%">交货日期</td>
						<th width="8%">状态</td>
						<th width="8%">操作</td>
	          		</tr>
					<c:forEach var="item" items="${qr.list}" varStatus="i">
					<c:if test="${(i.index mod 2)==0}"><c:set var="trClass" value="query_list_data_tr1" /></c:if>
					<c:if test="${(i.index mod 2)!=0}"><c:set var="trClass" value="query_list_data_tr2" /></c:if>
					<c:set var="defaultFontColor" value="black" />
					<c:if test="${item[1].examined=='Y'}"><c:set var="defaultFontColor" value="blue" /></c:if>
					<c:if test="${item[1].completed=='Y'}"><c:set var="defaultFontColor" value="red" /></c:if>
					<c:if test="${item[1].delivered=='Y'}"><c:set var="defaultFontColor" value="purple" /></c:if>
					<c:if test="${item[1].closed=='Y'}"><c:set var="defaultFontColor" value="green" /></c:if>
					<tr class="${trClass}" style="color:${defaultFontColor};cursor:pointer;" defaultFontColor="${defaultFontColor}" index="${i.index+1}" ondblclick='javascript:DoubleClick(this)' onClick='javascript:ClickCheck(this,true)' onmouseout='javascript:mouseout(this)' onmouseover='javascript:mouseover(this)'>
						<td><input type="checkbox" onClick="javascript:ClickCheck(this,true);" name='query_checkbox' value="${item[0].id}" examined="${item[1].examined}"></td>
						<td>
							<c:if test="${item[0].sourType=='ONLINE'}"><img src="/images/earth.png" title="网络自助下单"></c:if>
							${item[0].billCode}
						</td>
						<td><fmt:formatDate value="${item[0].orderDate}" pattern="yyyy-MM-dd HH:mm"/></td>
						<td>${item[2]}<c:if test="${item[0].linkman!=null && item[0].linkman!=''}">(${item[0].linkman})</c:if></td>
						<td>${item[0].content}</td>
						<td align="right"><c:if test="${showCost=='1'}">${item[0].cost}</c:if></td>
						<td align="right"><c:if test="${showCost=='1'}">${item[1].adjustCost}</c:if></td>
						<td align="right"><c:if test="${showCost=='1'}">${item[1].collectedCost}</c:if></td>
						<td align="right"><c:if test="${showCost=='1'}">${item[0].cost+item[1].adjustCost-item[1].collectedCost}</c:if></td>
						<td>${item[0].designerNameStr}</td>
						<td>${item[0].followerNameStr}</td>
						<td><c:if test="${item[1].printNum>0}">${item[1].lastPrinter}/${item[1].printNum}次</c:if></td>
						<td><c:if test="${item[0].deliverDate!=null}"><fmt:formatDate value="${item[0].deliverDate}" pattern="yyyy-MM-dd HH:mm"/></c:if></td>
						<td>
							<c:if test="${item[1].examined=='Y'}"><c:if test="${canUnExa=='Y' && item[1].closed=='N'}"><a href="javascript:showUnExaPage('${item[0].id}');"></c:if>已审核<c:if test="${canUnExa=='Y'}"></a></c:if></c:if>
							<c:if test="${item[1].examined=='N'}"><c:if test="${canExa=='Y'}"><a href="javascript:showExaPage('${item[0].id}');"></c:if>未审核<c:if test="${canExa=='Y'}"></a></c:if></c:if>
							<c:if test="${item[1].completed=='Y'}"><c:if test="${canUnCom=='Y' && item[1].closed=='N'}"><a href="javascript:showUnComPage('${item[0].billCode}');"></c:if>已完工<c:if test="${canUnCom=='Y' && item[1].closed=='N'}"></a></c:if></c:if>
							<c:if test="${item[1].completed=='N'}"><c:if test="${canCom=='Y' && item[1].closed=='N' && item[1].examined=='Y'}"><a href="javascript:showComPage('${item[0].billCode}');"></c:if>未完工<c:if test="${canCom=='Y' && item[1].closed=='N' && item[1].examined=='Y'}"></a></c:if></c:if>
							<br>
							<c:if test="${item[1].delivered=='N'}"><c:if test="${canDel=='Y' && item[1].examined=='Y' && item[1].closed=='N'}"><a href="javascript:showDelPage('${item[0].id}');"></c:if>未送货<c:if test="${canDel=='Y' && item[1].examined=='Y' && item[1].closed=='N'}"></a></c:if></c:if>
							<c:if test="${item[1].delivered=='P'}"><c:if test="${canDel=='Y' && item[1].examined=='Y' && item[1].closed=='N'}"><a href="javascript:showDelPage('${item[0].id}');"></c:if>未送完<c:if test="${canDel=='Y' && item[1].examined=='Y' && item[1].closed=='N'}"></a></c:if></c:if>
							<c:if test="${item[1].delivered=='Y'}"><c:if test="${canDelSearch=='Y' && item[1].closed=='N'}"><a href="javascript:showDelSearchPage('${item[0].billCode}');"></c:if>已送完<c:if test="${canDelSearch=='Y'}"></a></c:if></c:if>
							<c:if test="${item[1].closed=='Y'}"><c:if test="${canUnCol=='Y'}"><a href="javascript:showUnColPage('${item[0].id}');"></c:if>已结清<c:if test="${canUnCol=='Y'}"></a></c:if></c:if>
							<c:if test="${item[1].closed=='N'}"><c:if test="${canCol=='Y' && item[1].collected=='Y'}"><a href="javascript:showColPage('${item[0].id}');"></c:if>未结清<c:if test="${canCol=='Y' && item[1].collected=='Y'}"></a></c:if></c:if>
						</td>
						<td>
							<a href="javascript:doShow('${item[0].id}','${item[1].examined}');"><c:if test="${item[1].closed=='Y'}">查看</c:if><c:if test="${item[1].closed=='N'}">修改</c:if></a>
							<c:if test="${canRec=='Y' && item[1].examined=='Y' && item[1].closed=='N'}"><a href="javascript:showRecPage('${item[0].id}');"></c:if>收款<c:if test="${canRec=='Y' && item[1].examined=='Y' && item[1].closed=='N'}"></a></c:if>
							<c:if test="${canAdj=='Y' && item[1].examined=='Y' && item[1].closed=='N'}"><a href="javascript:showAdjPage('${item[0].id}');"></c:if>调账<c:if test="${canAdj=='Y' && item[1].examined=='Y' && item[1].closed=='N'}"></a></c:if>
							<br>
							<c:if test="${showCost=='1'}"><a href="javascript:showPrintSelect('${item[0].id}');"></c:if>打印<c:if test="${showCost=='1'}"></a></c:if>
							<a href="javascript:showRelBill('${item[0].billCode}');">单据跟踪</a>
						</td>
					</tr>
					</c:forEach>
				</table>
			</div>
			
			<!-- 底栏 分页、操作等 -->
	        <div class="BottomToolBar ClearFix">
			    <%@include file="../inc/Pages.jsp"%>
	        </div>
			
		</div>
	</div>
</div>
</body>
</html>
<script type="text/javascript">
	function ChangeWindowSize( container, maxWidth ){
	    setTimeout( function(){
	        var w1 = document.documentElement.clientWidth-40;
	        if( w1>maxWidth ) w1 = maxWidth;
	        else if( w1<970 ) w1 = 960;
	        container.style.width = w1+'px';
	    }, 300 );
	}
	var IsAdvSearch = false;
	(function(){
		doInit();
		doPrintCallBack();
	    var ListContainer = document.getElementById('ListContainer');
	    ChangeWindowSize( ListContainer, 2020 );    // 超过 1280 的最大 1260 ，不全部铺满
	
	    var lnkMoreOption   = document.getElementById('lnkMoreOption');
	    var lnkHiddenOption = document.getElementById('lnkHiddenOption');
	    lnkMoreOption.onclick = function(){
	    	IsAdvSearch = true;
	        document.getElementById('dvMoreOptionBox').style.display = 'block';
	        document.getElementById('cb_order_date').style.visibility = 'visible';
	        this.style.visibility = 'hidden';
	    };
	    lnkHiddenOption.onclick = function(){
	    	IsAdvSearch = false;
	        document.getElementById('dvMoreOptionBox').style.display = 'none';
	        document.getElementById('cb_order_date').style.visibility = 'hidden';
	        lnkMoreOption.style.visibility = 'visible';
	    };
	})();
</script>

